<%@page import="com.liferay.portal.service.ListTypeServiceUtil"%>
<%@page import="com.liferay.portal.model.ListType"%>
<%@page import="com.crossriver.crgis.database.model.impl.Bank_Payment_SlipImpl"%>
<%@page import="com.crossriver.crgis.database.model.Bank_Payment_SlipModel"%>
<%@page import="com.crossriver.crgis.database.model.impl.Bank_Payment_SlipModelImpl"%>
<%@page import="com.crossriver.crgis.database.model.Bank_Payment_Slip"%>
<%@page import="com.crossriver.crgis.cofo.util.PaymentBean"%>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ include file="/init.jsp"%>
<portlet:defineObjects />
<%
PaymentBean payBean = (PaymentBean)request.getAttribute("payBean");


Bank_Payment_Slip bankSlp = (Bank_Payment_Slip)request.getAttribute("bankSlp");
if (null == bankSlp){
	bankSlp = new Bank_Payment_SlipImpl();
}

%>

<liferay-portlet:actionURL name="updateDepositSlip" var="updateDepositSlip"></liferay-portlet:actionURL>
<aui:form name="frmPaymentMode" enctype="multipart/form-data" method="post" action="<%= updateDepositSlip.toString() %>">
<div id="main">
	<h1>Payment - Bank Slip Payment Upload</h1>
 	<div class="content"> 
  	<span class="title">Payment Mode - Bank Deposit</span>
    <hr>
   	Fill in the form below, to save your payment record. Enter the details in this form just as you filled the bank teller and other options appropriately. The Agency is not liable to any
		wrong information submitted. <br>
		All fields marked [<span class="mandatoryfld">*</span>] are mandatory!
    <br><br>
    <liferay-ui:error key="depositors-name-must-not-be-blank" message="depositors-name-must-not-be-blank" />
		<liferay-ui:error key="bank-name-must-not-be-blank" message="bank-name-must-not-be-blank" />
		<liferay-ui:error key="paid-amount-must-not-be-blank" message="paid-amount-must-not-be-blank" />
		<liferay-ui:error key="dep-slip-must-not-be-blank" message="dep-slip-must-not-be-blank" />
		<liferay-ui:error key="payment-slip-file-must-be-uploaded" message="payment-slip-file-must-be-uploaded" />
    
    <table width="100%" id="tabbankdep">
    	<tr>
    		<td width="30%">Application Reference Number:</td>
    		<td width="70%"><aui:input id="referenceNo" label="" name="referenceNo" readonly="readonly" value="<%=payBean.getPayment_params() %>"  /></td>
    	</tr>
    	<tr>
    		<td>Application ID:</td>
    		<td><aui:input id="applicationId" label="" name="applicationId" readonly="readonly" value="<%=payBean.getPayment_params() %>"   /></td>
    	</tr>
    	<tr>
    		<td>Amount To Be Paid:</td>
    		<td><aui:input id="approvedAmount" label="" readonly="readonly" name="approvedAmount" value="<%=payBean.getOutstandingAmount() %>"  /></td>
    	</tr>
    	<tr>
    		<td>Depositors Name<span class="mandatoryfld">*</span>:</td>
    		<td><aui:input label="" id="depositorName" name="depositorName" value="<%=bankSlp.getDepositorName() %>" type="text" helpMessage="Depositor's name must be same as the name on the Teller" /></td>
    	</tr>
    	<tr>
    		<td>Amount Paid-in<span class="mandatoryfld">*</span>:</td>
    		<td><aui:input label="" value="<%=bankSlp.getPaidAmount() %>" id="paidAmount" name="paidAmount"  /></td>
    	</tr>
    	<tr>
    		<td>Bank where deposit was made<span class="mandatoryfld">*</span>:</td>
    		<td>
    			<%
					List<ListType> banks = ListTypeServiceUtil.getListTypes("banks");
					%>
    			<aui:select id="bankName" label="" name="bankName">
						<option selected="selected" value="">---Please Select Bank</option>
						<%
								
								
						%>
						
						<%
				  	String bank = bankSlp.getBankName();
				  	for(int i=0; i<banks.size(); i++){
				  		ListType _bank = banks.get(i);
				  	%>	
			  		<aui:option selected="<%= _bank.getName().equalsIgnoreCase(bank)  %>" value="<%=_bank.getName() %>"><%=_bank.getName()  %></aui:option>
				  	<%
				  	}
				  	%>
					</aui:select>
    		</td>
    	</tr>
    	<tr>
    		<td>Deposit Slip Number<span class="mandatoryfld">*</span>:</td>
    		<td><aui:input value="<%=bankSlp.getDepSlipNo() %>" id="depSlipNo" label="" name="depSlipNo" /></td>
    	</tr>
    	<tr>
    		<td>Upload Deposit Slip<span class="mandatoryfld">*</span>:</td>
    		<td><aui:input id="uploadDepositSip" label="" name="uploadDepositSlip" type="file" /></td>
    	</tr>
    	<tr>
    		<td>&nbsp;</td>
    		<td>
    			<input id="savePaymentSlip" name="savePaymentSlip" type="button" onClick="submitPaymentSlip();" value="Save Payment Slip Information"  /> 
					<input name="Cancel" type="button" onClick="paymentCancel();" value="Cancel"></input> 
					<input name="back" type="button" value="Back" onClick="history.go(-1); return true;"></input>
    		</td>
    	</tr>
    </table>	
	</div>
</div>
</aui:form>

<liferay-portlet:actionURL name="cancel" var="cancel"></liferay-portlet:actionURL>
<form name="<portlet:namespace/>paymentCancel_fm" method="post"	id="<portlet:namespace/>paymentCancel_fm" action="<%=cancel.toString()%>">
</form>
<script type="text/javascript">
<!--
	
	function paymentCancel()
	{
		document.forms["<portlet:namespace/>paymentCancel_fm"].submit();
	}


	function submitPaymentSlip()
	{
		document.forms["<portlet:namespace/>frmPaymentMode"].submit();
	}

//-->
</script>
